//
//  common.h
//  leo
//
//  Created by 常艳 on 15/8/26.
//  Copyright (c) 2015年 mdx. All rights reserved.
//


#define leo_common_h
typedef enum
{
   user=0,
    watch,
    manager,
    grow,
    task,
    theme,
    position,
    message,
    event,
    chart   
}LeoTable;
#define TABLE_USER @"user"
#define TABLE_WATCH @"watch"
#define TABLE_MANAGER @"manager"
#define TABLE_bind @"bind"
#define TABLE_GROW @"grow"
#define TABLE_SYSTASK @"sys_task"
#define TABLE_TASK @"task"
#define TABLE_THEME @"theme"
#define TABLE_POSITION @"position"
#define TABLE_MESSAGE @"message"
#define TABLE_EVENT @"event"
#define TABLE_CHART @"chart"
#define TABLE_FENCE @"fence"
#define TABLE_REMIND @"remind"

#define SYNCCHATDATAFINISHED @"SyncChatDataFinished"
#define RESENDCHATSUCESS @"ResendChatSucess"
#define SYNCLASTPOSITIONDATAFINISHED @"SyncLastPositionDataFinished"
#define SYNCMOTIONTRACKDATAFINISHED @"SyncMotionTrackDataFinished"
#define SYNCREMINDFILEFINISHED @"SyncRemindFileFinished"
#define SELECTWATCH @"SelectWatch"
#define CHANGEWATCH @"ChangeWatch"
#define BINDCONFIRMFINISHED @"BindConfirmFinished"
#define CHANGEBABYINFO @"ChangeBabyInfo"
#define RECORDTIMEEXCEED @"RecoreTimeExceed"
#define CALLBLUEACCOMPANYVIEW @"CallBlueAccompanyView"
#define RECEIVEDPUSHTASK  @"PushTask"
#define BINDRELATIONCHANGE @"BindRelationChange"
#define VICEBINDREFUSE @"ViceBindRefuse"
#define ADMINDISABLED @"AdminDisabled"
#define UNBINDDEVICE @"UnbindDevice"
#define ENTERFOREGROUND @"EnterForeGround"
#define UNBINDALLDEVICE @"UnBindAllDevice"
#define SELECTDATEFROMCALENDAR @"SelectDateFromCalendar"
#define SYNCDATAINROUTEHISTORYVIEW @"syncDataInRouteHistoryViewController"
#define USERINFOUPDATE @"UserInfoUpdate"
#define MANAGERPHOTOUPDATE @"ManagerPhotoUpdate"
#define WATCHPHOTOUPDATE @"WatchPhotoUpdate"
#define ContactPHOTOUPDATE @"ContactPhotoUpdate"
#define LOCATIONRESULTARRIVED @"LocationResultArrived"
#define USERALREADYLOGIN @"UserAlreadLogin"
#define LONGTIMENOLOGIN @"LongTimeNoLogin"
#define WATCHSIMCHANGE @"WatchSimChange"
#define VICEADMINUNBINDDEVICE @"ViceAdminUnbindDevice"
#define VICEADMINBINDDEVICE @"ViceAdminbindDevice"
#define NEWHISTORYNOTIFICATION @"NewHistoryNotification"
#define HAVEALREADYGETPHONEPOSITION @"HaveAlreadyGetPhonePosition"
#define NOTIFYBLEDEVICEDISCONNECTED @"NotifyBLEDeviceDisConnected"
typedef enum
{
    FAIL=0,//失败，网络请求失败，或者返回数据不正确
    SUCESS,//成功
    NO_NET_WORK,// 没有网络
    PARAM_ILLEGAL,//参数不合法
    ERROR,//程序发生错误
    WRONG,//
    NODATA,
}SyncResult;//去服务器取数据时返回结果
typedef enum
{
    GET=0,
    POST,
    ASYNCGET,
    ASYNCPOST,
    POSTFILE,
    
}HttpMethord;
typedef enum
{
   ADMIN=1,
   VICE_ADMIN=2,
   CONTACT=3,
   SOS_CONTACT=4
    
}Role;
typedef enum
{
    MANAGER=1,
    PHONECONTACT=2,
    WATCH=3,
    USER=4
}Type;
typedef enum
{
    GROUPCHATFILE=1,
    REMINDFILE=2,
    SINGLEFILE=3
}fileType;
typedef enum
{
    SET_USERINFO_SUCESS=1,
    BIND_WATCH_SUCESS=2,
    SET_BABYINFO_SUCESS=3
}BindStep;
typedef enum
{
    PT_SETUP_LINK=0x101,
    PT_HEART_LINk=0x102,
    PT_VICE_BOUND_REQUEST=0x03,
    PT_BIND_RELATIONSHIP_CHAGE=0x04,
    PT_USER_INFO_UPDATE=0x11,
    PT_WATCH_SIM_CHANGE=0x12,
    PT_GEOFENCE_IN_OUT=0x31,
    PT_SINGLE_CHAT_UPDATE=0x41,
    PT_GROUP_CHAT_UPDATE=0x42,
    PT_LOCATE_RESULT=0x52,
    PT_SOS=0x54,
    PT_LOW_BATTERY=0x56,
    PT_BIRTHDAY_NOTIFY=0x57,
    PT_FESTIVAL_NOTIFY=0x58,
    PT_TASK=0x61,
    PT_FINISHTASK=0x62,
    PT_VICE_BIND_REFUSE=0x05,
    PT_ADMIN_DISBAND_NOTIFICATION=0x02,
    PT_USER_LOGIN_ON_OTHER_DEVICE=0x82,
    PT_VICEADMIN_JOIN=0x101,
}PushType;
typedef enum
{
    LOCATE_IMMEDIATELLY = 1,//立即定位
    REMOTE_CARE = 2, // 远程关怀
    REMOTE_SHUTDOWN = 3,//远程关机
    FACTORY_RESTORE_SETTING = 4,//恢复出厂设置
    SCHEDULE_OFF_AND_ON = 5,//定时开关机
    FIRMWARE_UPDATE = 6,//版本升级
    THEME_CHANGE=7
}CommandType;
typedef enum
{
    MESSAGE_PUSH=0,
    MESSAGE_TIME=1,
    TASK_PUSH=2,
    TASK_TIME=3,
    SHORTNUM=4 //UI更改
    
}SettingType;
typedef enum
{
    DOING=1,
    UNDO=2,
    DONE=3,
    EXPIRE=4,
}TaskStatus;
typedef enum
{
    SYSTASK=1,
    HISTORYTASK=2,
    PUSHTASK=3,
}TaskFileType;
typedef enum
{
    PROMPT=1,
    RECORD=2,
    CONFIRM=3
}Actiontype;
typedef enum
{
   PRESET_TASK=1,
    BIRTHDAY=2,
    FESTIVAL=3
}Tasktype;
#define appId  @"1040132103"//@"com.mdx.leo"
#define appkey @"100018"
#define appsecret @"100018"
#define protol @"https"
//#define hostName @"139.196.104.145:8443"
//#define socketHost @"139.196.104.145"
//#define socketPort @"9000"
#define hostName @"apis.atlasyun.net"
#define socketHost @"push.atlasyun.net"
#define socketPort @"12001"
//#define hostName @"test.apis.atlasyun.net"
//#define socketHost @"test.push.atlasyun.net"
//#define socketPort @"9000"

#define hostName1(isChange)  ((isChange)?(@"test.apis.atlasyun.net"):(@"apis.atlasyun.net"))
#define socketHost1(isChange)  ((isChange)?(@"test.push.atlasyun.net"):(@"push.atlasyun.net"))
#define socketPort1(isChange)  ((isChange)?(@"9000"):(@"12001"))

#define kTimeout 10
#define kStartDataStr @"\r\n\r\n"
#define kEndDataStr @"\r\n"
#define NO_NET_WORK_INFO   @"当前网络异常，请检查网络"
#define NO_DATA @"无数据"
#define DEVICE_ACCESS_TOKEN_EXPIRED  88204
#define SMSCODE_VERIFY_FAILED        89001
#define SMSCODE_VERIFY_FAILED_INFO @"验证码错误"
#define USER_ALREADY_EXIST  88101
#define USER_ALREADY_EXIST_INFO @"该用户已存在"
#define USER_ID_ILLEGAL  88102
#define USER_ID_ILLEGAL_INFO  @"用户ID非法"
#define USER_ACCESS_TOKEN_EXPIRED 88103
#define USER_ACCESS_TOKEN_EXPIRED_INFO @"Token过期"
#define USER_PWD_NOT_MATCH_USER      88104
#define USER_PWD_NOT_MATCH_USER_INFO      @"密码错误"
#define USER_UNEXIST  88105
#define USER_UNEXIST_INFO  @"用户不存在"
#define USER_LOGINED_ON_OTHER_DEVICE  88106
#define USER_LOGINED_ON_OTHER_DEVICE_INFO  @"您的帐号在别的地方登录，请重新登录"
#define USER_PERMISSION_NOT_ALLOWED  88107
#define USER_PERMISSION_NOT_ALLOWED_INFO @"没有权限执行该操作"
#define USER_VERIFY_CODE_ILLEGAL 88108
#define USER_VERIFY_CODE_ILLEGAL_INFO @"验证码不合法"
#define USER_REQUEST_ILLEGAL  88110
#define USER_REQUEST_ILLEGAL_INFO @"用户请求非法"
#define USER_BIND_DEVICE_NULL  88111
#define USER_BIND_DEVICE_NULL_INFO @"没有绑定的设备"
#define USER_UPDATE_PWD_FAILURE 88112
#define USER_UPDATE_PWD_FAILURE_INFO @"用户更新密码失败"
#define USER_BIND_REQUEST_REJECTED  88113
#define USER_BIND_REQUEST_REJECTED_INFO @"用户绑定请求被拒绝"
#define  USER_DEVICE_NOT_BOUND  88115
#define  USER_DEVICE_NOT_BOUND_INFO @"用户没有绑定关系"
#define USER_PHONENUM_NONEXIST  88117
#define USER_PHONENUM_NONEXIST_INFO @"手机号码不存在"
#define USER_PHONENUM_ALREADY_REGISTER  88118
#define USER_PHONENUM_ALREADY_REGISTER_INFO  @"该手机号码已注册"
#define USER_FULLNAME_NONEXIST  88120
#define USER_FULLNAME_NONEXIST_INFO @"用户名不存在"
#define USER_ACCOUNT_ALREADYEXIST 88121
#define USER_ACCOUNT_ALREADYEXIST_INFO @"账号已存在"
#define USER_GEOFENCE_IS_NULL 88122
#define USER_GEOFENCE_IS_NULL_INFO @"安全区域为空"
#define USER_GEOFENCE_NON_EXIST 88123
#define USER_GEOFENCE_NON_EXIST_INFO @"安全区域不存在"
#define USER_GEOFENCE_ALREADY_DELETED 88124
#define USER_GEOFENCE_ALREADY_DELETED_INFO @"安全区域已经被删除"
#define USER_CONTACT_ALREADY_EXIST 88125
#define USER_CONTACT_ALREADY_EXIST_INFO @"联系人已存在"
#define USER_CONTACT_NONEXIST 88126
#define USER_CONTACT_NONEXIST_INFO @"联系人不存在"
#define USER_CONTACT_ALREADY_DELETED 88127
#define USER_CONTACT_ALREADY_DELETED_INFO @"联系人已经被删除"
#define USER_REMINDER_ALREADY_EXIST 88128
#define USER_REMINDER_ALREADY_EXIST_INFO @"提醒已存在"
#define USER_REMINDER_NONEXIST 88129
#define USER_REMINDER_NONEXIST_INFO @"提醒不存在"
#define USER_REMINDER_ALREADY_DELETED 88130
#define USER_REMINDER_ALREADY_DELETED_INFO @"提醒已经被删除"
#define USER_SILENTPERIOD_ALREADY_EXIST 88131
#define USER_SILENTPERIOD_ALREADY_EXIST_INFO @"免打扰时段已存在"
#define USER_SILENTPERIOD_NONEXIST 88132
#define USER_SILENTPERIOD_NONEXIST_INFO @"免打扰时段不存在"
#define USER_SILENTPERIOD_ALREADY_DELETED 88133
#define USER_SILENTPERIOD_ALREADY_DELETED_INFO @"免打扰时段已经被删除"
#define DEVICE_ID_ILLEGAL  88201
#define DEVICE_ID_ILLEGAL_INFO @"非法设备"
#define DEVICE_ALREADY_BOUND  88203
#define DEVICE_ALREADY_BOUND_INFO @"您已绑定了watch"
#define SMS_SEND_FAILURE 88301
#define SMS_SEND_FAILURE_INFO @"短息验证码发送失败"
#define SMS_COUNT_REACH_UPPER_LIMIT  88302
#define SMS_COUNT_REACH_UPPER_LIMIT_INFO @"当日短信请求数量已达上限"
#define SMS_VERIFY_FAILURE 88303
#define SMS_VERIFY_FAILURE_INFO @"验证码验证失败"
#define SMS_FREQUENCY_TOO_FAST  88309
#define SMS_FREQUENCY_TOO_FAST_INFO @"短信请求过于频繁"
#define SYSTEM_INNER_ERROR 88701
#define SYSTEM_INNER_ERROR_INFO @"服务器内部错误"
#define API_INVOCATION_FAILED 88703
#define API_INVOCATION_FAILED_INFO @"服务器内部错误"
#define GROUP_USER_NOT_IN_ONE_GROUP 89702
#define GROUP_USER_NOT_IN_ONE_GROUP_INFO @"用户不在一个群组里"
#define DEVICE_VERSION_IS_NEWEST 89802
#define DEVICE_VERSION_IS_NEWEST_INFO @"手表已经是最新版本了"
#define APP_VERSION_IS_NEWEST 89801
#define APP_VERSION_IS_NEWEST_INFO @"APP已经是最新版本了"
#define API_REFRESHTOKEN_INVALID 88119
#define API_REFRESHTOKEN_INVALID_INFO @"长时间未登录，请重新登录"
#define DEVICE_NONEXIST 88205
#define DEVICE_NONEXIST_INFO @"设备不存在"
#define DEVICE_OFFLINE 88207
#define DEVICE_OFFLINE_INFO @"手表不在线"
#define USER_NUM_UP_TO_LIMIT 88139
#define USER_NUM_UP_TO_LIMIT_INFO @"一个手表最多只能被10个账号绑定"
#define USER_BOUND_DEVICE_UP_TO_LIMIT 88140
#define USER_BOUND_DEVICE_UP_TO_LIMIT_INFO @"一个账号最大支持绑定10个手表，最多成为3个表的主管理员"
#define BINDERROR_WATCH_NOT_REGISTER 0
#define BINDERROR_WATCH_NOT_REGISTER_INFO @"手表没有注册成功"
#define BINDERROR_WATCH_NOT_GETBINDCODE 000000001
#define BINDERROR_WATCH_NOT_GETBINDCODE_INFO @"手表没有获取到绑定码"






















